from flask import Flask,request
from flask import render_template
# 调用自定义模块中的函数
from research import reserch4letters

app = Flask(__name__)


@app.route('/')
def hello_world():  # put application's code here
    return render_template('hello01.html')

@app.route('/hello01',methods=['GET','POST'])
def hello01():  # put application's code here
    return render_template('hello01.html')


@app.route('/hello02',methods=['GET','POST'])
def hello02():  # put application's code here
    return render_template('hello02.html')

@app.route('/index2',methods=['GET','POST'])
def index2():  # put application's code here
    return render_template('index2.html')

@app.route('/index3',methods=['GET'])
def index3():  # put application's code here
    return render_template('index3.html')

@app.route('/login',methods=['GET'])
def login():  # put application's code here
    return render_template('login.html')

@app.route('/register',methods=['GET'])
def register():  # put application's code here
    return render_template('register.html')

@app.route('/result2',methods=['POST'])
def result2():  # put application's code here
    py_word = request.form['word']
    py_vowels = request.form['vowels']
    py_found = reserch4letters(py_vowels, py_word)

    return render_template('result2.html',
                           found = py_found)

@app.route('/result3', methods=['POST'])
def result3():  # put application's code here
    first_name = request.form['firstname']
    last_name = request.form['lastname']
    full_name = first_name.title() + ' ' + last_name.title()
    return render_template('result3.html',
                           fullname=full_name)

@app.route('/goodslist',methods=['GET'])
def goodslist():  # put application's code here
    return render_template('goodslist.html')

@app.route('/car',methods=['GET','POST'])
def car():  # put application's code here
    return render_template('car.html')

@app.route('/buy',methods=['GET','POST'])
def buy():  # put application's code here
    return render_template('buy.html')

if __name__ == '__main__':
    app.run(host='127.0.0.1',port=5000,debug=True)
